{% extends 'layout.html' %}
{% block jquerypluginlib %}
    <link rel="stylesheet" href="{{ url_for('static',filename='lib/jquery.validationEngine/css/validationEngine.jquery.css') }}" type="text/css">
    <script type="text/javascript" src="{{ url_for('static',filename='lib/jquery.validationEngine/js/jquery.validationEngine.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static',filename='lib/jquery.validationEngine/js/languages/jquery.validationEngine-zh_CN.js') }}"></script>
{% endblock jquerypluginlib %}
{% block main %}
    {% if session.logged_in %}
    <script type=text/javascript>
        $(function() {
            //$( "#v_vaildend,#v_vaildstart").datepicker();
            $( "#v_cutoffdate" ).datepicker({
                //defaultDate: "+1w",
                //changeMonth: true,
                //numberOfMonths: 3,
                //currentText: "Today",
                onClose: function( selectedDate ) {
                    //$( "#v_saildate" ).datepicker( "option", "maxDate", "+1w" );
                    //console.log(selectedDate);
                    if(selectedDate){
                        var d=new Date(selectedDate);
                        //console.log(d);
                        sailmaxdate=new Date(d.getTime()+6*1000*60*60*24);
                        //console.log($.datepicker.formatDate( 'yy-mm-dd', sailmaxdate ) );
                        $( "#v_saildate" ).datepicker( "option", "minDate", selectedDate );
                        $( "#v_saildate" ).datepicker( "option", "maxDate", sailmaxdate );
                    }

                }
            });
            //console.log($( "#v_cutoffdate" ).datepicker("getDate"));

{#            $( "#v_vaildend").datepicker( "setDate", new Date());#}

            $( "#v_saildate" ).datepicker({
                //defaultDate: "+1w",
                //changeMonth: true,
                //numberOfMonths: 3,
                onClose: function( selectedDate ) {
                    if(selectedDate){
                        $( "#v_cutoffdate" ).datepicker( "option", "maxDate", selectedDate );
                        var d=new Date(selectedDate);
                        //console.log(d);
                        vaildstart=new Date(d.getTime()-6*1000*60*60*24);
                        //console.log($.datepicker.formatDate( 'yy-mm-dd', vaildstart ) );
                        $( "#v_vaildend" ).val(selectedDate);
                        $( "#v_vaildstart").val($.datepicker.formatDate( 'yy-mm-dd', vaildstart ));
                    }
                }
            });
            var json_fee,json_money,select_fee,select_money;
            $("#form1").validationEngine('attach',{
                validationEventTrigger:'submit'
            });
            $.getJSON("/_json_port",function(data){
                json_port=data.result[0];
                json_fee=data.result[1];
                json_money=data.result[2];
                json_vessel=data.result[3];
{#                select_fee=Init_Fee(json_fee);#}
{#                select_money=Init_Moeny(json_money);#}

                function ac(sn,jv){
                    $("."+sn).live("keydown.autocomplete",function(){
                        $(this).autocomplete({
                            source:function(request,response){
                                var results = $.ui.autocomplete.filter(jv, request.term);

                                response(results.slice(0, 10));
                            },
                            minLength: 1,
                            delay:0,
                            select:function(event,ui){
                                $(this).prev().val(ui.item.id);
                            }
                        });

                    });

                }

                json_vessel= $.map(json_vessel,function(item){
                   return {
                       label:item.VesselNameEn+'('+item.VesselName+')',
                       value:item.VesselNameEn,
                       id:item.VesselID
                   }
                });
{#                $(".acvessel").live("keydown.autocomplete",function(){#}
{#                    $(this).autocomplete({#}
{#                        source:function(request,response){#}
{#                            var results = $.ui.autocomplete.filter(json_vessel, request.term);#}
{##}
{#                            response(results.slice(0, 10));#}
{#                        },#}
{#                        minLength: 1,#}
{#                        delay:0,#}
{#                        select:function(event,ui){#}
{#                            $(this).prev().val(ui.item.id);#}
{#                        }#}
{#                    });#}
{##}
{#                });#}

                json_port=$.map(json_port,function(item){
                    return {
                        label:item.PortNameEn+'('+item.PortName+')'+item.CountryName,
                        value:item.PortNameEn,
                        id:item.PortID
                    }

                });
{#                $(".acport").live("keydown.autocomplete",function(){#}
{#                    $(this).autocomplete({#}
{#                        source:function(request,response){#}
{#                            var results = $.ui.autocomplete.filter(json_port, request.term);#}
{##}
{#                            response(results.slice(0, 10));#}
{#                        },#}
{#                        minLength: 1,#}
{#                        delay:0,#}
{#                        select:function(event,ui){#}
{#                            $(this).prev().val(ui.item.id);#}
{#                        }#}
{#                    });#}
{#                });#}

                ac('acport',json_port);
                ac('acvessel',json_vessel);

                $(".acport,.acvessel").live("keydown.autocomplete",function(){
                    $(this).autocomplete({
                        change: function( event, ui ) {
                            if ( !ui.item ) {
                                // no item selected
                                $(this).prev().val('0');
                                $(this).css('color','red');
                            }else{
                                $(this).css('color','');
                            }
                        }
                    });
                });
                $(".acport,.acvessel").live("input.autocomplete",function(){
                    $(this).trigger('keydown.autocomplete');
                });
{#                $(".acport").live("blur",function(){#}
{#                    if($(this).val()==""){#}
{#                        $(this).prev().val("0");#}
{#                    }#}
{#                });#}
{#                add_rows(10);#}

            });

            function Init_Fee(foo){
                var selstr="<select class='fee_name' name='fee_name_"+foo+"'>";
                $.each(json_fee,function(i,item){
                    selstr+='<option value="'+item.SurchargeCateID+'" title="'+item.SurchargeCateName+'">'+item.SurchargeCateShort+'</option>';
                });
                selstr+="</select>";
                return selstr;
            }
            function Init_Moeny(foo){
                var selstr="<select class='fee_money' name='fee_money_"+foo+"'>";
                $.each(json_money,function(i,item){
                    selstr+='<option value="'+item.MoneyID+'">'+item.Money3Code+'</option>';
                });
                selstr+="</select>";
                return selstr;
            }

{#            function add_feeone_row(json_fee,json_money){#}
{#                var row_str="<tr>";#}
{#                row_str+="<td>"+select_fee+"</td>"+#}
{#                        "<td>"+select_money+"</td>"+#}
{#                        "<td><input name='temp_fee_20gp' size='4' /></td>"+#}
{#                        "<td><input name='temp_fee_40gp' size='4' /></td>"+#}
{#                        "<td><input name='temp_fee_40hq' size='4' /></td>"+#}
{#                        "<td><input name='temp_fee_45hq' size='4' /></td>"+#}
{#                        "<td><input class='del_temp_fee_row' type='button' value='-' /></td></tr>";#}
{#                return row_str;#}
{#            }#}
            function add_feeone_table(foo){
                var table_str="<table id='t_fee_"+foo+"' class='bordertable narrow fee_t'><thead><tr>"+
                    "<th colspan='7'>海运附加费_"+(foo+1)+"</th></tr></thead><tbody><tr>"+
                    "<td>名称</td>"+
                    "<td>币种</td>"+
                    "<td>20GP</td>"+
                    "<td>40GP</td>"+
                    "<td>40HQ</td>"+
                    "<td>45HQ</td>"+
                    "<td><input class='add_fee_row' type='button' value='新增' data-foo='"+foo+"' /></td>"+
                    "</tr></tbody></table>";
                return table_str;
            }
            function add_feeone_row(foo){
                var row_str="<tr>";
                row_str+="<td>"+Init_Fee(foo)+"</td>"+
                        "<td>"+Init_Moeny(foo)+"</td>"+
                        "<td><input name='fee_20gp_"+foo+"' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='fee_40gp_"+foo+"' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='fee_40hq_"+foo+"' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='fee_45hq_"+foo+"' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input class='del_fee_row' type='button' value='删除' /></td></tr>";
                return row_str;
            }
            function add_feetable(foo){
                $("#section_fee").append(add_feeone_table(foo));
            }
{#            function add_one_row(){#}
{#                var row_id=$("#voyage_list tbody").find("tr").length;#}
{#                row_id++;#}
{#                var row_str="<tr>";#}
{#                row_str+="<td>"+row_id+"</td>"+#}
{#                        "<td><input name='v_unloadport' value='0' type='hidden' /><input class='acport' /></td>"+#}
{#                        "<td><input name='v_transitport' value='0' type='hidden' /><input class='acport' value='直达' /></td>"+#}
{#                        "<td><input name='v_searange' size='3' /></td>"+#}
{#                        "<td><input name='v_p20gp' size='4' /></td>"+#}
{#                        "<td><input name='v_p40gp' size='4' /></td>"+#}
{#                        "<td><input name='v_p40hq' size='4' /></td>"+#}
{#                        "<td><input name='v_p45hq' size='4' /></td>"+#}
{#                        "<td><input name='v_m20gp' size='4' /></td>"+#}
{#                        "<td><input name='v_m40gp' size='4' /></td>"+#}
{#                        "<td><input name='v_m40hq' size='4' /></td>"+#}
{#                        "<td><input name='v_m45hq' size='4' /></td>"+#}
{#                        "<td><input name='v_n20gp' size='4' /></td>"+#}
{#                        "<td><input name='v_n40gp' size='4' /></td>"+#}
{#                        "<td><input name='v_n40hq' size='4' /></td>"+#}
{#                        "<td><input name='v_n45hq' size='4' /></td>"+#}
{#                        "<td><input name='v_remarks' size='4' /></td>"+#}
{#                        "</tr>";#}
{#                return row_str;#}
{#                #}
{#            }#}
            function add_one_row(){
                var row_id=$("#voyage_list tbody").find("tr").length;
                row_id++;
                var row_str="<tr>";
                row_str+="<td class='center'>"+row_id+"<br /><a href='#' class='hide_row'>X</a></td>"+
                        "<td><input name='v_unloadport' value='0' type='hidden' /><input class='acport' /></td>"+
                        "<td><input name='v_transitport' value='0' type='hidden' /><input class='acport' value='直达' /></td>"+
                        "<td><input name='v_searange' size='3' class='validate[custom[integer]]' /></td>"+
                        "<td><input name='v_p20gp' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_p40gp' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_p40hq' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_p45hq' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_m20gp' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_m40gp' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_m40hq' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_m45hq' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_n20gp' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_n40gp' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_n40hq' size='4' class='validate[custom[number]]' /></td>"+
                        "<td><input name='v_n45hq' size='4' class='validate[custom[number]]' /></td>"+
                        "<td class='center'><a href='#' class='v_fee_a center' data-foo='"+(row_id-1)+"'>附</a></td>"+
                        "<td><textarea name='v_remarks' cols='15' rows='2'></textarea></td>"+
                        "</tr>";
                return row_str;

            }
            function add_rows(rows){
                for(var i=0;i<rows;i++){
                    $("#voyage_list").find("tbody").append(add_one_row());
                }
            }
            $("#add_ten_row").click(function(){
                add_rows(10);
            });
            $("#add_one_row").click(function(){
                add_rows(1);
            });
{#            $("#add_temp_fee_row").click(function(){#}
{#                $("#temp_fee").find("tbody").append(add_feeone_row());#}
{#            });#}
            $(".add_fee_row").live('click',function(){
{#                $("#form1").validationEngine('detach');#}
                $(this).closest('tbody').append(add_feeone_row($(this).data("foo")));
{#                $("#form1").validationEngine('attach');#}
            });
{#            $(".del_temp_fee_row").live('click',function(){#}
{#                $(this).closest('tr').remove();#}
{#            });#}
            $(".del_fee_row").live('click',function(){
                $(this).closest('tr').remove();
            });
            $(".v_fee_a").live('click',function(){
                $(".fee_t").hide();
                if(!$("#t_fee_"+$(this).data("foo")).length){
                    add_feetable($(this).data("foo"));
                }
                $("#t_fee_"+$(this).data("foo")).show();
            });

            $(".acport").live('focus',function(){
                if($(this).val()==this.defaultValue&&$(this).val()=="直达"){
                    $(this).val('');
                }
            });
            $(".acport").live('blur',function(){
                if($(this).val()==''&&this.defaultValue=="直达"){
                    $(this).val(this.defaultValue);
                    $(this).prev().val("0");
                }
            });



            $(".hide_row").live('click',function(){
                //console.log($(this).closest('tr').find(".v_fee_a").data("foo"));
                $tr=$(this).closest("tr");
                $("#t_fee_"+$tr.find(".v_fee_a").data("foo")).hide();
                $tr.find("input[name='v_unloadport']").val("0");
                $tr.find(".acport").val("");
                $tr.hide();
            });

        });
    </script>
    <div id="main">
    <div class="ym-wrapper">
    <div class="ym-wbox" id="div_voyage">
    <form id="form1" method="post">
        <section>
            <div class="ym-grid">
                <div class="ym-g66 ym-gl">
                    <table class="bordertable narrow">
                        <thead>
                        <tr>
                            <th colspan="6">运价信息模板</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>船名</td>
                            <td><input type="hidden" name="v_vesselid" value="{{ common_voyage.VesselID or '0' }}" /><input class="acvessel" name="v_vessel" value="{{ common_voyage.VesselNameEn or '' }}" /></td>
                            <td>航次</td>
                            <td><input name="v_voyagenumbername" value="{{ common_voyage.VoyageNumberName or '' }}" /></td>
                            <td>航线</td>
                            <td>
                                <select name="v_line">
                                    {% for line in lines %}
                                        <option value="{{ line.LineID }}" {% if line.LineID==common_voyage.LineID|default(0) %}selected="selected"{% endif %}>{{ line.LineName }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>起运港</td>
                            <td>
                                <select name="v_loadport">
                                    <option value="1">宁波</option>
                                </select>
                            </td>
                            <td>码头</td>
                            <td>
                                <select name="v_pier">
                                    {% for pier in piers %}
                                        <option value="{{ pier.PierID }}" {% if pier.PierID==common_voyage.PierID|default(0) %}selected="selected"{% endif %}>{{ pier.PierName }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>截/开</td>
                            <td><input name="v_cutoffsail" size="3" class="validate[custom[cutoffsail]]" value="{% if common_voyage.CutOff and common_voyage.Sail %}{{ common_voyage.CutOff }}/{{ common_voyage.Sail }}{% endif %}" /></td>
                            <td>截关日期</td>
                            <td><input id="v_cutoffdate" name="v_cutoffdate" size="10" readonly="readonly" class="validate[required]" value="{{ common_voyage.CutOffDate or '' }}" /></td>
                            <td>开船日期</td>
                            <td><input id="v_saildate" name="v_saildate" size="10" readonly="readonly" class="validate[required]" value="{{ common_voyage.SailDate or '' }}" /></td>
                        </tr>

                        <tr>
                            <td>船司</td>
                            <td>
                                <select name="v_shipcompany">
                                    {% for shipcompany in shipcompanys %}
                                        <option value="{{ shipcompany.ShipCompanyID }}" {% if shipcompany.ShipCompanyID==common_voyage.ShipCompanyID|default(0) %}selected="selected"{% endif %}>{{ shipcompany.ShipCompanyShort }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                            <td>船代</td>
                            <td>
                                <select name="v_shipagent">
                                {% for shipagent in shipagents %}
                                    <option value="{{ shipagent.ShipAgentID }}" {% if shipagent.ShipAgentID==common_voyage.ShipAgentID|default(0) %}selected="selected"{% endif %}>{{ shipagent.ShipAgentShort }}</option>
                                {% endfor %}
                                </select>
                            </td>
                            <td>订舱</td>
                            <td>
                                <select name="v_booking">
                                {% for booking in bookings %}
                                    <option value="{{ booking.BookingID }}" {% if booking.BookingID==common_voyage.BookingID|default(0) %}selected="selected"{% endif %}>{{ booking.BookingShort }}</option>
                                {% endfor %}
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>开始期</td>
                            <td><input id="v_vaildstart" name="v_vaildstart" size="10" readonly="readonly" class="validate[required,custom[date]]" value="{{ common_voyage.VaildStart or '' }}" /></td>
                            <td>结束期</td>
                            <td><input id="v_vaildend" name="v_vaildend" size="10" readonly="readonly" class="validate[required,custom[date]]" value="{{ common_voyage.VaildEnd or '' }}" /></td>
                            <td>订舱信息</td>
                            <td><input id="v_bookinginfo" name="v_bookinginfo" size="10" value="{{ common_voyage.BookingInfo or '' }}" /></td>
                        </tr>
                        <tr>
                            <td>备注</td>
                            <td colspan="5"><textarea name="v_batchremarks" cols="60" rows="5">{{ common_voyage.BatchRemarks or '' }}</textarea></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="ym-g33 ym-gr" id="section_fee">
{#                    <table id="temp_fee" class="bordertable narrow">#}
{#                        <thead>#}
{#                            <tr>#}
{#                                <th colspan="7">海运附加费模板</th>#}
{#                            </tr>#}
{#                        </thead>#}
{#                        <tbody>#}
{#                            <tr>#}
{#                                <td>名称</td>#}
{#                                <td>币种</td>#}
{#                                <td>20GP</td>#}
{#                                <td>40GP</td>#}
{#                                <td>40HQ</td>#}
{#                                <td>45HQ</td>#}
{#                                <td><input id="add_temp_fee_row" type="button" value="+" /></td>#}
{#                            </tr>#}
{#                            {% for exfee in exfees %}#}
{#                            <tr>#}
{#                                <td>#}
{#                                    <select class="temp_fee_name" name="temp_fee_name">#}
{#                                        {% for surchargecate in surchargecates %}#}
{#                                            <option value="{{ surchargecate.SurchargeCateID }}" title="{{ surchargecate.SurchargeCateName }}" {% if surchargecate.SurchargeCateID==exfee.SurchargeCateID %}selected="selected"{% endif %}>{{ surchargecate.SurchargeCateShort }}</option>#}
{#                                        {% endfor %}#}
{#                                    </select>#}
{#                                </td>#}
{#                                <td>#}
{#                                    <select class="temp_fee_money" name="temp_fee_money">#}
{#                                        {% for money in moneys %}#}
{#                                            <option value="{{ money.MoneyID }}" {% if money.MoneyID==exfee.MoneyID %}selected="selected"{% endif %}>{{ money.Money3Code }}</option>#}
{#                                        {% endfor %}#}
{#                                    </select>#}
{#                                </td>#}
{#                                <td><input name="temp_fee_20gp" size="4" value="{{ exfee.S20GP|int(default='') }}" /></td>#}
{#                                <td><input name="temp_fee_40gp" size="4" value="{{ exfee.S40GP|int(default='') }}" /></td>#}
{#                                <td><input name="temp_fee_40hq" size="4" value="{{ exfee.S40HQ|int(default='') }}" /></td>#}
{#                                <td><input name="temp_fee_45hq" size="4" value="{{ exfee.S45HQ|int(default='') }}" /></td>#}
{#                                <td><input class="del_temp_fee_row" type="button" value="-" /></td>#}
{#                            </tr>#}
{#                            {% endfor %}#}
{#                        </tbody>#}
{#                    </table>#}
                    {% for exfee in exfees %}
                        {% if exfee %}
                    <table id="t_fee_{{ loop.index0 }}" class="bordertable narrow fee_t">
                        <thead>
                        <tr>
                            <th colspan="7">海运附加费_{{ loop.index }}</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>名称</td>
                            <td>币种</td>
                            <td>20GP</td>
                            <td>40GP</td>
                            <td>40HQ</td>
                            <td>45HQ</td>
                            <td><input class="add_fee_row" type="button" value="新增" data-foo="{{ loop.index0 }}" /></td>
                        </tr>
                        {% set vloop=loop %}
                        {% for per_e in exfee %}
                        <tr>
                            <td>
                                <select class="fee_name" name="fee_name_{{ vloop.index0 }}">
                                    {% for surchargecate in surchargecates %}
                                        <option value="{{ surchargecate.SurchargeCateID }}" title="{{ surchargecate.SurchargeCateName }}" {% if surchargecate.SurchargeCateID==per_e.SurchargeCateID %}selected="selected"{% endif %}>{{ surchargecate.SurchargeCateShort }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                            <td>
                                <select class="fee_money" name="fee_money_{{ vloop.index0 }}">
                                    {% for money in moneys %}
                                        <option value="{{ money.MoneyID }}" {% if money.MoneyID==per_e.MoneyID %}selected="selected"{% endif %}>{{ money.Money3Code }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                            <td><input name="fee_20gp_{{ vloop.index0 }}" size="4" value="{{ per_e.S20GP|int(default='') }}" class="validate[custom[number]]" /></td>
                            <td><input name="fee_40gp_{{ vloop.index0 }}" size="4" value="{{ per_e.S40GP|int(default='') }}" class="validate[custom[number]]" /></td>
                            <td><input name="fee_40hq_{{ vloop.index0 }}" size="4" value="{{ per_e.S40HQ|int(default='') }}" class="validate[custom[number]]" /></td>
                            <td><input name="fee_45hq_{{ vloop.index0 }}" size="4" value="{{ per_e.S45HQ|int(default='') }}" class="validate[custom[number]]" /></td>
                            <td><input class="del_fee_row" type="button" value="删除" /></td>
                        </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                        {% endif %}
                    {% endfor %}

                </div>
            </div>
        </section>
        <section id="">
            <table id="voyage_list" class="bordertable narrow">
                <thead>
                    <tr>
                        <th rowspan="2">No</th>
                        <th rowspan="2">目的港</th>
                        <th rowspan="2">中转港</th>
                        <th rowspan="2">航程</th>
                        <th colspan="4">公布价</th>
                        <th colspan="4">会员价</th>
                        <th colspan="4">净价</th>
                        <th rowspan="2">附</th>
                        <th rowspan="2">备注</th>
                    </tr>
                    <tr>
                        <th>20GP</th>
                        <th>40GP</th>
                        <th>40HQ</th>
                        <th>45HQ</th>
                        <th>20GP</th>
                        <th>40GP</th>
                        <th>40HQ</th>
                        <th>45HQ</th>
                        <th>20GP</th>
                        <th>40GP</th>
                        <th>40HQ</th>
                        <th>45HQ</th>
                    </tr>
                </thead>
                <tbody>
                {% for voyage in voyages %}
                    <tr>
                        <td class="center">{{ loop.index }}<br /><a href="#" class="hide_row">X</a></td>
                        <td><input name="v_unloadport" value="{{ voyage.UnloadPort }}" type="hidden" /><input class="acport" value="{{ voyage.UnloadPortNameEn }}" /></td>
                        <td><input name="v_transitport" value="{{ voyage.TransitPort }}" type="hidden" /><input class="acport" value="{{ voyage.TransitPortNameEn }}" /></td>
                        <td><input name="v_searange" size="3" value="{{ voyage.SeaRange }}" class="validate[custom[integer]]" /></td>
                        <td><input name="v_p20gp" size="4" value="{{ voyage.P20GP|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_p40gp" size="4" value="{{ voyage.P40GP|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_p40hq" size="4" value="{{ voyage.P40HQ|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_p45hq" size="4" value="{{ voyage.P45HQ|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_m20gp" size="4" value="{{ voyage.M20GP|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_m40gp" size="4" value="{{ voyage.M40GP|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_m40hq" size="4" value="{{ voyage.M40HQ|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_m45hq" size="4" value="{{ voyage.M45HQ|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_n20gp" size="4" value="{{ voyage.N20GP|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_n40gp" size="4" value="{{ voyage.N40GP|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_n40hq" size="4" value="{{ voyage.N40HQ|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><input name="v_n45hq" size="4" value="{{ voyage.N45HQ|int(default='') }}" class="validate[custom[number]]" /></td>
                        <td><a href="#" class="v_fee_a center" data-foo="{{ loop.index0 }}">附</a></td>
                        <td><textarea name="v_remarks" cols="15" rows="2">{{ voyage.Remarks or '' }}</textarea></td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </section>
{#        <input type="hidden" value="{{ batchid|default('0') }}" name="v_batchid" />#}
        <input id="add_one_row" type="button" value="增1行" />
        <input id="add_ten_row" type="button" value="增10行" />
        <input name="submit" type="submit" value="新增批次" />
        {% if batchid %}
            <input name="submit" type="submit" value="保存批次" />
            <input name="submit" type="submit" value="删除批次" />
        {% endif %}

    </form>
    </div>
    </div>
    </div>
    {% else %}
        没有登陆
    {% endif %}

{% endblock main %}


